<template>
  <div :style="'height:' + height">
    <iframe :src="url"  style="width: 100%; height: 100%"/>
  </div>
</template>
<script>
import {getToken} from "@/utils/auth";

export default {
  name: "WarmChart",
  props: {
    // 组件调用时传入的流程实例ID
    insId: { type: [String, Number], default: null }
  },
  data() {
    return {
      height: document.documentElement.clientHeight - 200 + "px;",
      url: "",
    };
  },

  watch: {
    insId: {
      immediate: true, // 立即执行 handler 方法
      handler(newVal) {
        // 更新 url，添加时间戳防止缓存
        this.url = `${process.env.VUE_APP_FLOW_API}/warm-flow-ui/index.html?id=${newVal}&type=FlowChart&Authorization=Bearer ${getToken()}`;
      }
    }
  },

};
</script>
